import ajax from './index'

export function agency_list(condition) {
  if (!condition) {
    condition = {
      pageNum: 1,
      pageSize: 100
    }
  }
  return ajax({
    url: "/backend/partner/list",
    method: "get",
    params: condition
  });
}

export function agency_save(param) {
  return ajax({
    url: "/backend/partner/save",
    method: "post",
    data: param
  });
}

export function agency_detail(id) {
  return ajax({
    url: "/backend/partner/" + id,
    method: "get"
  });
}

export function agency_del(id) {
  return ajax({
    url: "/backend/partner/delete?ids=" + id,
    method: "post"
  });
}

export function agency_check(id) {
  return ajax({
    url: "/backend/partner/check?ids=" + id,
    method: "post"
  });
}

export function agency_check2(id) {
  return ajax({
    url: "/backend/partner/check2?ids=" + id,
    method: "post"
  });
}

export function agency_refuse(id) {
  return ajax({
    url: "/backend/partner/refuse?ids=" + id,
    method: "post"
  });
}

export function agency_account_list(gency_id, condition) {
  if (!condition) {
    condition = {
      page: 1,
      num: 100
    }
  }
  return ajax({
    url: "/backend/partner_account/list/" + gency_id,
    method: "get",
    params: condition
  });
}

export function agency_role_list(agency_id) {
  return ajax({
    url: "/backend/partner/role/list/" + agency_id,
    method: "get"
  });
}
export function agency_account_register(agency_id, param) {
  return ajax({
    url: "/backend/partner_account/register/" + agency_id,
    method: "post",
    data: param
  });
}

export function agency_account_detail(agency_id, id) {
  return ajax({
    url: "/backend/partner_account/detail/" + agency_id + "/" + id,
    method: "get"
  });
}
export function agency_account_update(agency_id, id, param) {
  return ajax({
    url: "/backend/partner_account/update/" + agency_id + "/" + id,
    method: "post",
    data: param
  });
}
export function agency_account_delete(agency_id, id) {
  return ajax({
    url: "/backend/partner_account/delete/" + agency_id + "/" + id,
    method: "post"
  });
}
export function agency_account_update_password(agency_id, data) {
  return ajax({
    url: "/backend/partner_account/updatePassword/" + agency_id,
    method: "post",
    data: data
  });
}

export function agency_menus() {
  return ajax({
    url: "/backend/partner/role/menus",
    method: "get"
  });
}
export function agency_role_create(agency_id, param) {
  return ajax({
    url: "/backend/partner/role/create/" + agency_id,
    method: "post",
    data: param
  });
}

export function agency_role_detail(agency_id, id) {
  return ajax({
    url: "/backend/partner/role/detail/" + agency_id + "/" + id,
    method: "get"
  });
}
export function agency_role_edit(agency_id, id, param) {
  return ajax({
    url: "/backend/partner/role/edit/" + agency_id + "/" + id,
    method: "post",
    data: param
  });
}
export function agency_role_delete(agency_id, id) {
  return ajax({
    url: "/backend/partner/role/delete/" + agency_id + "/" + id,
    method: "post"
  });
}
export function agency_categories(parent_id) {
  return ajax({
    url: "/backend/product/categories/" + parent_id,
    method: "get"
  });
}

export function agency_withdraw_list(condition) {
  if (!condition) {
    condition = {
      pageNum: 1,
      pageSize: 20
    }
  }
  return ajax({
    url: "/backend/partner/withdraw_list",
    method: "get",
    params: condition
  });
}
export function agency_withdraw_do(param) {
  return ajax({
    url: "/backend/partner/withdraw_do",
    method: "post",
    data: param
  });
}

export function agency_money_record_list(condition) {
  if (!condition) {
    condition = {
      pageNum: 1,
      pageSize: 100
    }
  }
  return ajax({
    url: "/backend/partner/money_record_list",
    method: "get",
    params: condition
  });
}

export function agency_money_record_list_export(condition) {
  return ajax({
    url: "/backend/partner/money_record_list_export",
    method: "get",
    params: condition
  });
}

export function agency_cat_tree(agency_id) {
  return ajax({
    url: "/backend/partner/cat_tree/" + agency_id,
    method: "get"
  });
}

// 合伙人
export function order_settle_list(condition) {
  if (!condition) {
    condition = {
      pageNum: 1,
      pageSize: 20
    }
  }
  return ajax({
    url: "/backend/order/partner_settle_list",
    method: "get",
    params: condition
  });
}
export function order_settle_list_export(condition) {
  return ajax({
    url: "/backend/order/partner_settle_list_export",
    method: "get",
    params: condition
  });
}
export function order_profit_list(condition) {
  if (!condition) {
    condition = {
      pageNum: 1,
      pageSize: 20
    }
  }
  return ajax({
    url: "/backend/order/partner_order_profit_list",
    method: "get",
    params: condition
  });
}
export function order_profit_list_export(condition) {
  return ajax({
    url: "/backend/order/partner_order_profit_list_export",
    method: "get",
    params: condition
  });
}
